package com.st.service.serviceImpl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.st.vo.GoodsDetailListVo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.st.dao.GoodsDetailMapper;
import com.st.pojo.GoodsDetail;
import com.st.service.GoodsDetailService;
@Service
public class GoodsDetailServiceImpl extends ServiceImpl<GoodsDetailMapper, GoodsDetail> implements GoodsDetailService{

    @Resource
    private  GoodsDetailMapper goodsDetailMapper;

    @Override
    public int batchInsert(List<GoodsDetail> list) {
        return baseMapper.batchInsert(list);
    }

    @Override
    public List<GoodsDetailListVo> getList() {

        List<GoodsDetailListVo> goodsDetailLists = new ArrayList<>();
        Page<GoodsDetail> page = new Page(1,1);
        List<GoodsDetail> goodsDetails = goodsDetailMapper.selectList(null);
        for (GoodsDetail goodsDetail : goodsDetails) {
            GoodsDetailListVo goodsDetailListVo =  new GoodsDetailListVo(goodsDetail.getName(),goodsDetail.getEnlishName(),goodsDetail.getIconUrl(),goodsDetail.getImgUrl(),goodsDetail.getTarget(),goodsDetail.getTip());
            goodsDetailLists.add(goodsDetailListVo);
        }
        return goodsDetailLists;
    }
}
/*为了提交*/